package com.frxuexi.shop.adapter

import androidx.databinding.DataBindingUtil
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.ShopBeanItem
import com.frxuexi.shop.R
import com.frxuexi.shop.databinding.ItemShopBinding

class ShopAdapter:BaseQuickAdapter<ShopBeanItem,BaseViewHolder>(R.layout.item_shop) {

    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemShopBinding>(viewHolder.itemView)
    }

    override fun convert(helper: BaseViewHolder, item: ShopBeanItem) {
        val binding = DataBindingUtil.getBinding<ItemShopBinding>(helper.itemView)!!
        binding.bean=item

        Glide.with(context).load(item.image).into(binding.shopIv)
    }
}